/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.trandio.dao;

import java.sql.SQLException;
import java.util.List;
import javax.naming.NamingException;
import org.trandio.hb.TbPrioridadAdmision;
import org.trandio.util.HibernateUtil;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author root
 */
public class PrioridadAdmisionDAO implements PrioridadAdmisionInterface {
    
    private Session sesion;
    
  @Override
    public List<TbPrioridadAdmision> ConsultarPrioridadAdmision() throws SQLException, NamingException {

        sesion = HibernateUtil.getSessionFactory().openSession();

        Query q;

        q = sesion.createQuery("from TbPrioridadAdmision");

        return q.list();


    }

    @Override
    public List<TbPrioridadAdmision> ConsultarPrioridadAdmision(int idPrioridadAdmision) throws SQLException, NamingException {

        sesion = HibernateUtil.getSessionFactory().openSession();

        Query q;

        q = sesion.createQuery("from TbPrioridadAdmision where id=?").setInteger(0, idPrioridadAdmision);

        return q.list();
    }
 
    
}
